package com.example.myapp;

import android.content.ContentValues;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.example.myapp.db.MyHelper;

public class MyDataUtil {

    public void insertData(Context context, String username, String password) {
        MyHelper myHelper = new MyHelper(context);
        SQLiteDatabase database = myHelper.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put("username", username);
        values.put("password", password);
        database.insert("user", null, values);
        database.close();
    }
    public void updateData(Context context,String username,String password){
        MyHelper myHelper = new MyHelper(context);
        SQLiteDatabase database = myHelper.getWritableDatabase();
        ContentValues values = new ContentValues();
        values.put("username", username);
        values.put("password", password);
        database.update("user",values,"id=3",null);
        database.close();
    }
}